<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>输入验证</title>
  </head>
  <body>
    <div class="box">
      <form action="">
        <label for="name">
          名字：
          <input type="text" v-model.lazy="inputName" />
        </label>
        <span>{{hint}}</span>
        <p>{{valueChaneg}}</p>
      </form>
    </div>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script>
      new Vue({
        el: '.box',
        data: {
          inputName: '',
          hint: '',
        },
        methods: {},
        computed: {
          valueChaneg: function () {
            this.hint = '验证'
            console.log(this.inputName)
            setTimeout(() => {
              if (this.inputName == 'one') {
                this.hint = 'no'
              } else {
                this.hint = 'yes'
              }
            }, 500)
            // if (this.inputName == 'one') {
            // }
          },
        },
        watch: {},
      })
    </script>
  </body>
</html>
